﻿using SqlSugar;

namespace CommonBaseEntityDb.Db
{
    /// <summary>
    /// 生成实体类使用的帮助类
    /// </summary>
    public class DbClient
    {
        /// <summary>
        /// 数据库操作类
        /// </summary>
        public SqlSugarClient instance { get; }

        /// <summary>
        /// 自动生成实体类使用
        /// </summary>
        /// <param name="connString"></param>
        public DbClient(string connString)
        {
            //创建数据库对象
            instance = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = connString,
                DbType = DbType.SqlServer,
                IsAutoCloseConnection = true
            });
            instance.Ado.CommandTimeOut = 60;
        }
    }
}
